﻿using System;
using OS.Infrastructure.Domain;

namespace TaskKernel.Domain
{
    public abstract class AbstractTaskHistoryEntry : AbstractEntity
    {
        public virtual DateTime DateCreate { get; protected set; }
        public virtual Account Owner { get; protected set; }
        public virtual HistoryEntryType TaskHistoryEntryType { get; protected set; }
        public virtual Task Task { get; protected set; }
        public virtual string Comment { get; protected set; }
        public virtual File File { get; protected set; }
    }

    public class FileTaskHistoryEntry : AbstractTaskHistoryEntry
    {
        protected FileTaskHistoryEntry()
        {
        }

        public FileTaskHistoryEntry(Task task, File file, HistoryEntryType type)
            : this()
        {
            Task = task;
            Owner = file.Owner;
            DateCreate = DateTime.Now;
            TaskHistoryEntryType = type;
            File = file;
        }

        public override File File { get; protected set; }
    }

    public class CommentTaskHistoryEntry : AbstractTaskHistoryEntry
    {
        protected CommentTaskHistoryEntry()
        {
        }

        public CommentTaskHistoryEntry(Task task, Account account, String comment, HistoryEntryType type)
            : this()
        {
            Task = task;
            Owner = account;
            DateCreate = DateTime.Now;
            TaskHistoryEntryType = type;
            Comment = comment;
        }

        public override string Comment { get; protected set; }
    }

    public class InvisibleSystemMessage : AbstractTaskHistoryEntry
    {
        protected InvisibleSystemMessage()
        {
        }

        public InvisibleSystemMessage(Task task, Account account, String comment, HistoryEntryType type)
            : this()
        {
            Task = task;
            Owner = account;
            DateCreate = DateTime.Now;
            TaskHistoryEntryType = type;
            Comment = comment;
        }

        public override string Comment { get; protected set; }
    }
}